<?php
//404错误处理
$container['notFoundHandler'] = function($c) {
	return function($request, $response) use ($c) {
		 return $response->withRedirect($c->router->pathFor('Error404'));
//		include APP_PATH . "Views/404.html";
	};
};

//500错误处理
$container['errorHandler'] = function($c) {
	return function($request, $response, $exception) use ($c) {
		include APP_PATH . "Views/500.html";
	};
};

//405
$container['notAllowedHandler'] = function($c) {
	return function($request, $response, $methods) use ($c) {
		return $c['response'] -> withStatus(405) -> withHeader('Allow', implode(', ', $methods)) -> withHeader('Content-type', 'text/html') -> write('Method must be one of: ' . implode(', ', $methods));
	};
};


?>